package ldkxingzhe.ldkxingzhedemo;

import android.app.Application;
import android.content.pm.ApplicationInfo;

import ldkxingzhe.ldkxingzhedemo.utils.DemoGlobal;

/**
 * Created by ke on 15-9-4.
 */
public class LdkXingZheApplication extends Application{
    @Override
    public void onCreate() {
        super.onCreate();
        DemoGlobal.isDebug = isApkDebug();
    }

    /**
     * 判断apk是否是debug状态
     * @return  true -- debug版本， false --- release版本
     */
    private boolean isApkDebug(){
        try{
            ApplicationInfo info = getApplicationInfo();
            return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        }catch (Exception e){
            return false;
        }
    }
}
